home *** CD-ROM | disk | FTP | other *** search
/ Professional Soft Collection 1.02 / Professional Soft Collection 1.02.iso / qemm.80c / technote.qip / STLTECH.TEC < prev    next >
Text File  |  1995-11-04  |  22KB  |  390 lines

  1.  
  2.              An Overview of QEMM's StealthROM Technology
  3.  
  4.  Quarterdeck Technical Note #168              Filename: STLTECH.TEC
  5.  by Michael Bolton                          CompuServe: STTECH.ZIP
  6.  Last revised: 12/14/94                       Category: QEMM
  7.  
  8.  Subject: An overview of QEMM's Stealth ROM technology -- how it
  9.            works, why it works so well, and what can cause
  10.            complications for it.
  11.  
  12.  Q: What is StealthROM?
  13.  Q: How does StealthROM work?
  14.  Q: What is the difference between ST:M and ST:F?
  15.  Q: Which StealthROM strategy is preferable?
  16.  Q: Does StealthROM slow down my system?
  17.  Q: How can StealthROM fail?
  18.  Q: If I'm having problems with StealthROM, what should I do?
  19.  
  20.  Note: for the purposes of this note, "386" refers to any processor
  21.  in the 80386 family -- the Intel 80386 SX and DX; the i486 SX and
  22.  DX in all their flavors; the Pentium processor, and all processors
  23.  compatible with these chips.
  24.  
  25.  Traditionally, 386 memory managers such as QEMM have been able to
  26.  create extra memory for DOS by associating physical extended
  27.  memory (memory above the 1MB line, which is outside of DOS'
  28.  address space) with unused addresses between 640K and 1MB.  This
  29.  extra memory is called High RAM. Quarterdeck's StealthROM
  30.  technology (which is included with QEMM versions 6.00 and higher)
  31.  is QEMM's method of creating more High RAM than previously thought
  32.  possible, by mapping memory to addresses that are used by system,
  33.  video, disk, and other ROMs.
  34.  
  35.  Q. How does StealthROM work?
  36.  
  37.  To understand how StealthROM works, it is useful to understand the
  38.  concept of MAPPING.  When a program needs more memory than what is
  39.  normally available to it under DOS, it can request that some
  40.  expanded memory be allocated from either an EMS board, or from the
  41.  EMS memory created by a 386 expanded memory manager. MAPPING is
  42.  the process by which memory management hardware and software can
  43.  make memory appear in appropriate places at appropriate times; it
  44.  is the process of associating memory with an address other than
  45.  its actual one.  A convenient place to make memory appear is a 64K
  46.  window of addresses above the 640K line; this window is called the
  47.  EMS page frame.  The expanded memory specification (EMS) uses
  48.  mapping to make portions of expanded memory appear inside the EMS
  49.  page frame when that memory is requested by a program.
  50.  
  51.  Expanded memory has no addresses of its own, but can be made to
  52.  appear at a valid address -- "mapped in".  Expanded memory pages
  53.  can be filled with code or data by a program; when that code or
  54.  data is not needed, the pages can  may be "mapped out" -- relieved
  55.  of their addresses and put back into the expanded memory pool,
  56.  with the code and data still intact. When the application needs
  57.  these pages, they are "mapped in" to the EMS page frame again.  It
  58.  is therefore possible for a program that uses expanded memory to
  59.  have access to much more memory than DOS itself can see of its own
  60.  accord.  You may know this technology as "bank switching," which
  61.  is one of the techniques used to extend and add power to
  62.  everything from mainframe computers to high-end UNIX systems... to
  63.  DOS machines!
  64.  
  65.  Mapping is also useful for creating High RAM; in addition the the
  66.  page frame, memory can be associated with other unused addresses
  67.  between 640K and 1MB.  The 386 hardware and QEMM cooperate to make
  68.  memory appear where there is otherwise none.
  69.  
  70.  StealthROM uses mapping for a new purpose.  The 386 chip can be
  71.  made to map memory in or out of DOS' address space at any time.
  72.  StealthROM uses 386 mapping to map system, disk, or video ROMs in
  73.  and out of DOS' address space when appropriate, using one of two
  74.  strategies -- Mapping mode or Frame mode.  These two features are
  75.  activated by parameters on the QEMM line -- ST:M, for Stealth
  76.  Mapping, or ST:F, for Stealth Frame.
  77.  
  78.  Q. What is the difference between ST:M and ST:F?
  79.  
  80.  "BIOS" stands for "Basic Input Output Services", programs that are
  81.  built right into the hardware of your system in a form called
  82.  "Read-Only Memory".  Your system communicates with various parts
  83.  of itself and with its peripherals via the ROM-BIOS, often
  84.  referred to as "ROMs".  The ROMs on your system are accessed via
  85.  interrupts -- which are conceptually similar to BASIC subroutines.
  86.  When your system boots up, it sets up something called an
  87.  interrupt vector table.  This is a list of addresses where
  88.  specific ROM subroutines can be found. When a program on your
  89.  system needs a certain ROM function (for example, writing colored
  90.  text to the screen), it sets up some data in appropriate places,
  91.  and then calls the interrupt with a processor INT instruction. The
  92.  processor then looks at the interrupt vector table to find out the
  93.  address where the ROM function can be found.  The processor
  94.  transfers control to that address, the ROM subroutine gets run,
  95.  and then control is returned to the calling program.
  96.  
  97.  When you use StealthROM, as your system boots QEMM takes control
  98.  of interrupts that are in use by the ROMs on your system and
  99.  points those interrupts into QEMM itself.  This way, QEMM can
  100.  monitor exactly when a ROM interrupt occurs, and can manage the
  101.  interrupt appropriately.
  102.  
  103.  When you use ST:M ("Mapping Method"), QEMM maps system, video, and
  104.  disk ROMs and any other "Stealthable" ROMs out of the first
  105.  megabyte. (For information on what is "Stealthable," see "How can
  106.  StealthROM fail?" below.)  When the ROM is needed by the system,
  107.  QEMM maps the appropriate ROM code into the expanded memory page
  108.  frame.  The ROM code now has a valid address at which it can
  109.  execute, and it does so normally.  When the ROM routine is
  110.  finished, QEMM then remaps the ROM elsewhere out of the address
  111.  space.
  112.  
  113.  When you use ST:F ("Frame Method"), QEMM leaves the system, video,
  114.  and disk ROMs where they are normally found.  QEMM then places the
  115.  EMS page frame at the same address as -- or "on top of" -- a ROM.
  116.  Expanded memory can then be mapped into the EMS page frame.  When
  117.  the ROM that has been hidden by the page frame is needed, QEMM
  118.  maps the page frame away, and maps ROM back into the addresses
  119.  that were occupied by the page frame.  The ROM code then executes
  120.  normally. When the ROM routine is finished, QEMM can then restore
  121.  the contents of the page frame, and the ROM is effectively hidden
  122.  again.
  123.  
  124.  Q. Which StealthROM strategy is preferable?
  125.  
  126.  Since ST:M is capable of mapping almost all ROMs out of DOS'
  127.  address space, and thus provides much more High RAM, it is the
  128.  better of the two options.  ST:F should only be needed on a very
  129.  small number of systems; its object is to ensure compatibility
  130.  with machines that have ROMs that jump to each other without using
  131.  an interrupt to do so, or with ROMs that need to execute at their
  132.  original addresses.
  133.  
  134.  Q. I have to have a special version of QEMM so that StealthROM
  135.  will work on my system, right?  My system has to be one that
  136.  StealthROM knows about, right?  I have to disable some of QEMM's
  137.  memory management features to take advantage of StealthROM, right?
  138.  
  139.  No to all three questions!  StealthROM is designed to work on ANY
  140.  system, regardless of brand, model, or ROM BIOS revision.  You do
  141.  not need a special version of QEMM or StealthROM that has been
  142.  customized for your machine, because StealthROM's strategy merely
  143.  relocates your ROMs instead of replacing them.  StealthROM does
  144.  not modify, compress or replace your ROM BIOS, and it does not
  145.  depend on being aware of the brand or revision of your ROMs.
  146.  Additionally, StealthROM will typically create more High RAM on
  147.  your system than any other memory management technique.  You do
  148.  not have to disable any of QEMM's features -- EMS, XMS, DPMI, or
  149.  VCPI memory management.  Other memory managers force you to
  150.  sacrifice features or compatibility as they try to match QEMM's
  151.  prowess in squeezing every last byte of High RAM from your system.
  152.  
  153.  Q. Does StealthROM slow my system down?
  154.  
  155.  StealthROM does add some tiny amount of overhead to ROM BIOS
  156.  interrupts.  Since most application programs spend very little
  157.  time calling ROM code, the slowdowns are usually imperceptible or
  158.  insignificant to the user. Ironically, since benchmark programs
  159.  often call ROM interrupts repeatedly  (some do almost nothing but
  160.  this), the greatest slowdown will be seen in some benchmark
  161.  results; these results rarely have much to do with the actual
  162.  speed of useful programs, however. Since your application programs
  163.  typically have much more conventional memory to deal with when
  164.  StealthROM is invoked, you are more likely to observe faster --
  165.  not slower -- performance. Furthermore, QEMM optimizes some ROM
  166.  video functions with its own faster techniques when StealthROM is
  167.  active, and QEMM's ROM parameter (see the QEMM documentation) can
  168.  provide additional performance increases. Using StealthROM with
  169.  the ROM parameter is typically significantly faster than not using
  170.  QEMM at all.
  171.  
  172.  Q.   How can StealthROM fail?
  173.  
  174.  StealthROM is a robust and proven technology.  However, it is
  175.  possible for programs or system ROM implementations to interfere
  176.  with StealthROM's strategies. Note that the problems described
  177.  here are infrequent and/or system-specific, and that most users
  178.  will experience no difficulty at all with StealthROM.
  179.  
  180.  In the above description of how StealthROM works, each strategy
  181.  depends on a processor interrupt being referenced.  This is the
  182.  normal way of accessing ROM code; processor registers are loaded
  183.  with data and with information which denotes exactly which ROM
  184.  service is being requested, and then a processor INT instruction
  185.  is called.  BASIC programmers will recognize that this is similar
  186.  to the process of initializing a few variables with data, and then
  187.  calling a subroutine with a GOSUB instruction; most good texts
  188.  favor this method of programming.  However, it is possible (though
  189.  relatively uncommon) for a piece of code to JUMP to a specific ROM
  190.  address, without branching via an interrupt.  This is analogous to
  191.  a BASIC GOTO, rather than a GOSUB; dependencies on GOTOs are
  192.  generally frowned upon by expert programmers, since a GOTO
  193.  presumes that the address to which the code is jumping will remain
  194.  constant and unchanging. This is less of a problem if one person
  195.  writes all the code, since it is easier for one person to keep
  196.  track of the proper destination addresses; when more than one
  197.  person is involved, it's more difficult to determine why and where
  198.  the code should branch.
  199.  
  200.  A few addresses in the interrupt vector table are used to point to
  201.  tables of BIOS data, rather than to executable code.  StealthROM
  202.  is designed to account for these sorts of addreses as well; as
  203.  with program code, QEMM points the processor to appropriate data
  204.  if an address in the interrupt vector table points to system
  205.  configuration information, rather than to BIOS program routines.
  206.  
  207.  If an application or utility jumps directly to a ROM address when
  208.  StealthROM is invoked, QEMM will not be able to intercept an
  209.  interrupt, and thus may not have a chance to make sure that the
  210.  appropriate portion of the ROM code is mapped into the page frame.
  211.  If QEMM's Optimize program detects this behavior, it can make the
  212.  application work properly with StealthROM by applying the
  213.  STEALTHTHUNK parameter, sacrificing a small amount of High RAM
  214.  (usually 4K) in order to intercept the direct jump, map the
  215.  appropriate ROM into the page frame, and divert the direct jump to
  216.  the proper address.  If the behavior does not occur during the
  217.  Optimize process, it will probably be necessary to EXCLUDE a
  218.  portion of the ROM on the QEMM386.SYS line in the CONFIG.SYS. More
  219.  information on STEALTTHUNK parameter can be found in the QEMM
  220.  Reference Manual (or in the README file in some releases).
  221.  
  222.  In the case of system setup programs and installation routines for
  223.  video cards (many of which access ROM addresses directly), it is
  224.  far better to disable QEMM temporarily than to use EXCLUDEs or
  225.  sacrifice the large amounts of extra High RAM that ST:M can
  226.  provide.  Setup programs should need to be run infrequently, and
  227.  typically require a reboot before the modified settings take
  228.  effect. High RAM is generally much more useful. It is worth
  229.  weighing the benefits of instant access to your setup program
  230.  against the extra High RAM that StealthROM can provide; the
  231.  decision should not be a difficult one.
  232.  
  233.  The easiest way to deal with this is to disable QEMM, run your
  234.  Setup program, and reboot with QEMM active again.  To disable QEMM
  235.  temporarily, hold down the <Alt> key immediately after you hear a
  236.  beep on bootup.  QEMM will post a message telling you to press
  237.  <Escape> to unload QEMM, or any other key to continue with QEMM.
  238.  Press <Escape>, and run your Setup program.  (If you are using the
  239.  DOS-UP feature from QEMM version 7.0 or later, you will first see
  240.  a message asking if you want to unload DOSDATA.  Press <Escape> to
  241.  unload DOSDATA, then hold down the <Alt> key again until you see
  242.  the message telling you to press <Escape> to unload QEMM.  After
  243.  unloading QEMM, run your Setup program, then reboot the machine
  244.  normally (without holding down <Alt>); your revised Setup will be
  245.  in effect, and so will QEMM.
  246.  
  247.  * Some ROMs are written in such a way that they jump internally to
  248.    addresses that are "hard-wired" into the ROM code.  For
  249.    instance, a ROM that lives at address C000 may jump within
  250.    itself using a full address like C000:AD91, where a jump to
  251.    offset AD91 would have had the same effect.  Jumps to explicit
  252.    addresses can confound StealthROM, as the ROM does not always
  253.    execute at its original address. The best way of getting around
  254.    this problem is often to use ST:M, and to place the EMS page
  255.    frame to be placed on top of the ROM in question; this means
  256.    that the ROM will execute at its original location without any
  257.    sacrifice of High RAM. If you cannot put the page frame over the
  258.    offending ROM, the ST:F option is another method of guaranteeing
  259.    that all ROMs will execute at their original addresses.
  260.  
  261.  * Sometimes one ROM will jump directly into another ROM's code
  262.    instead of accessing the other ROM through interrupts.  In such
  263.    circumstances, ST:F may be helpful, since the ROMs will all
  264.    execute at their original addresses, making both inter-ROM and
  265.    intra-ROM jumps safe.
  266.  
  267.  * Some programs find the address of a given piece of ROM at
  268.    startup, and then jump directly to that address later on, at a
  269.    time when the ROM may not be mapped into memory.  Programs like
  270.    these will often require that a portion of the ROM be EXCLUDEd
  271.    on the QEMM386.SYS line in CONFIG.SYS.  Quarterdeck Technical
  272.    Note #205, Troubleshooting Stealth ROM (STEALTH.TEC) can assist
  273.    in finding the appropriate EXCLUDE quickly.
  274.  
  275.  * Some ROMs do not have any interrupts pointing to them at
  276.    startup. If this is the case, QEMM will not be able to detect
  277.    where a given interrupt should point, and thus may not invoke
  278.    StealthROM for that ROM.  Again, Quarterdeck Technical Note
  279.    #205, Troubleshooting Stealth ROM (STEALTH.TEC) may help to
  280.    determine which addresses within this ROM must be EXCLUDEd (for
  281.    compatiblity) or can be INCLUDEd (for more High RAM).
  282.  
  283.  * Some device drivers refuse to load unless they see an interrupt
  284.    pointing to its normal location. Quarterdeck Technical Note
  285.    #233, "QEMM and the XSTI parameter", XSTI.TEC, explains another
  286.    way to resolve this problem which usually results in more
  287.    conventional memory saved than if the driver is loaded before
  288.    QEMM.  The DEVICE= lines that refer to these programs may also
  289.    be loaded before the QEMM386.SYS line in CONFIG.SYS (though
  290.    after DOSDATA.SYS) if necessary.
  291.  
  292.  * Some programs make invalid assumptions about the EMS page frame.
  293.    In some cases, programs assume that the state of the EMS page
  294.    frame will remain unchanged even after they decide to release
  295.    their claim to a page of expanded memory; this is akin to
  296.    assuming that you can get your property back after leaving it at
  297.    the end of the driveway on garbage pick-up day.  This fails with
  298.    Stealth ROM because, by default, the page frame is immediately
  299.    un-mapped after a handle has been abandoned -- as if, in the
  300.    above example, the city picks up the garbage pretty much
  301.    immediately -- as soon as you get back into your house.  The
  302.    UFP:N parameter suppresses this feature and can make such
  303.    careless programs work with StealthROM, perhaps at the expense
  304.    of some speed.
  305.  
  306.  * Some applications assume that the contents of the page frame
  307.    will be the same at hardware interrupt time as they are when the
  308.    main body of the application is executing -- like assuming that
  309.    your coat will never get moved from the place in which you saw
  310.    the cloakroom attendant put it.  This is an invalid assumption,
  311.    and can cause problems not only with StealthROM, but with
  312.    EMS-using TSRs as well. This ignores the guidelines in the
  313.    Expanded Memory Specification, which governs the proper use of
  314.    expanded there.
  315.  
  316.  * Other programs outright violate the Expanded Memory
  317.    Specification by placing their interrupt stacks -- effectively
  318.    the program's means of keeping track of its current state -- in
  319.    the page frame.  This is not simply a problem for StealthROM or
  320.    for QEMM; this can cause a conflict with any using expanded
  321.    memory and ANY expanded memory manager.
  322.  
  323.  Fortunately, the programs that exhibit these problems are rare. If
  324.  you experience difficulty that is found to be Stealth-related, you
  325.  might wish to encourage the developer of the faulting program to
  326.  make the program more compatible with StealthROM.  Quarterdeck is
  327.  very happy to assist the developer of any commercial hardware or
  328.  software who wishes added compatibility with our products.
  329.  
  330.  Q. What does the ROM parameter have to do with StealthROM?
  331.  
  332.  ROM code is normally read 8 or 16 bits at a time, and 32-bit RAM
  333.  is therefore much faster.  (You can see this in action by looking
  334.  at Manifest First Meg / Timings, first without the ROM parameter
  335.  on the QEMM386.SYS line in CONFIG.SYS, and then with ROM added to
  336.  the end of that line.)  Some video ROM speed-up drivers work by
  337.  copying the contents of video ROM to conventional RAM.  These
  338.  programs (such as TVGABIO.SYS, RAMBIOS.SYS, FASTBIOS.SYS, and
  339.  SPEED_UP.SYS, typically shipped on the utilities diskette provided
  340.  with your video card) will often conflict with StealthROM.  If
  341.  loaded after QEMM, such programs may refuse to load because they
  342.  detect that a program loaded before them (QEMM) is intercepting
  343.  the video interrupt, INT 10.  Conversely, if loaded before QEMM,
  344.  these programs may divert interrupts into RAM, so that QEMM cannot
  345.  locate the ROM handler for those interrupts.  In these cases, the
  346.  video speed-up program will function properly, but Stealth ROM
  347.  will be disabled. XSTI.TEC explains how to resolve this problem if
  348.  you really want to load the video enhancement program.  However,
  349.  QEMM's ROM parameter generally provides the same feature these
  350.  drivers do, with three important advantages.  First, QEMM copies
  351.  the video ROM into 32-bit RAM and then write-protects the RAM so
  352.  that some errant program does not overwrite the ROM code.  Second,
  353.  QEMM's ROM parameter costs neither conventional memory nor High
  354.  RAM to provide this feature -- the video drivers mentioned above
  355.  will typically take 32K of one or the other.  Finally, the ROM
  356.  parameter is fully compatible with StealthROM.
  357.  
  358.  Q. If I'm having problems with StealthROM, what should I do?
  359.  
  360.  StealthROM problems can be resolved by consulting Quarterdeck
  361.  Technical Note #205, "Troubleshooting StealthROM" (STEALTH.TEC).
  362.  If you are using QEMM version 7.0 or later, this technote was
  363.  installed in your \QEMM\TECHNOTE directory.  This and other
  364.  Quarterdeck Technical Notes are also available on the Quarterdeck
  365.  BBS at (310) 309-3227, CompuServe (!GO QUARTERDECK), or large
  366.  local BBS systems, and also via our Q/FAX fax retrieval service;
  367.  from the handset of your fax machine, call (310) 309-3214.
  368.  
  369.  Summary
  370.  
  371.  StealthROM is a robust and proven technology.  It is an
  372.  easy-to-use, safe, and efficient way of creating more High RAM on
  373.  your system, providing more memory for your TSRs, your device
  374.  drivers, DESQview 386, MS Windows, and your application programs.
  375.  It is likely to speed up your system rather than slowing it down.
  376.  It is designed to be effective on any 386 or higher processor,
  377.  regardless of the ROM's manufacturer or version.  Many programs
  378.  that cause conflicts with StealthROM can cause problems with other
  379.  programs and memory managers. Stealth conflicts are rare, and
  380.  troubleshooting is straightforward. StealthROM is the easiest way
  381.  to provide the optimal amount of High RAM on your system.
  382.  
  383.  ******************************************************************
  384.  *      Trademarks are property of their respective owners.       *
  385.  *   This and other technical notes may be available in updated   *
  386.  *     forms through Quarterdeck's standard support channels.     *
  387.  *          Copyright (C) 1995 Quarterdeck Corporation            *
  388.  ******************** E N D   O F   F I L E ***********************
  389.  
  390.